﻿using System.Collections.Generic;
using UnityEngine;
/*测试随机数*/
public class Test_Random1 : MonoBehaviour
{
    private void Update1()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            print(Random.Range(0f,10f));
        }
    }
    //练习：按空格产生方块 让x轴的位置在0，10之间随机
    private void Update2()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            GameObject go= GameObject.CreatePrimitive(PrimitiveType.Cube);
            go.transform.position =new Vector3( Random.Range(0f, 10f),0,0);
        }
    }
    private void OnGUI()
    {
        if (GUILayout.Button("测试"))
        {
            print("DNMD");
        }
    }
}
[ExecuteInEditMode]
public class Test_Random : MonoBehaviour 
{
    public Rect buttnRect;
    private void OnGUI()
    {
        if (GUI.Button(buttnRect,"开始游戏"))
        {
            print("开始游戏");
        }
    }
}
